<?php
include_once($_SERVER['DOCUMENT_ROOT']."/config.php");
include_once($gDOCUMENT_ROOT_SYSTEM.'include/filmAction.php');
include_once($gDOCUMENT_ROOT_SYSTEM.'templates/include/addon.php');
include_once($gDOCUMENT_ROOT_SYSTEM.'written_language/check_written_language.php');
$filmAction = new filmAction();

$douban_id=$_GET['douban_id'];
//如果存在
if(file_exists("./".$douban_id."/index.html"))
{
	//输出
	//include("./".$douban_id."/index.html");
}
//else//不存在，则录入
{
	$where = array('douban_id'=>$douban_id);
	$column='*';
	$film_info = $filmAction->getFilmDetail($where,$column,$user_agent['written_language_tag']);
	if(empty($film_info))
	{
		header("Location: ./new_subject");
	}
	else
	{
		include_once($gDOCUMENT_ROOT_SYSTEM.'/check_view.php');
		include_once($gDOCUMENT_ROOT_SYSTEM.'include/filmReleaseOnBluRayAction.php');
		$filmReleaseOnBluRayAction = new filmReleaseOnBluRayAction();
		include_once($gDOCUMENT_ROOT_SYSTEM.'include/spokenLanguageAction.php');
		$spokenLanguageAction = new spokenLanguageAction();
		
		$release_on_blu_ray = $filmReleaseOnBluRayAction->getFilmReleaseByFilmId($film_info['id']);
		
		include_once($gDOCUMENT_ROOT_SYSTEM.'include/filmReleaseOnDVDAction.php');
		$filmReleaseOnDVDAction = new filmReleaseOnDVDAction();
		$release_on_dvd = $filmReleaseOnDVDAction->getFilmReleaseByFilmId($film_info['id']);
		
		include_once($gDOCUMENT_ROOT_SYSTEM.'include/dao/film_download.php');
		$source_type = film_download::$source_type;
		
		include_once($gDOCUMENT_ROOT_SYSTEM.'include/filmDownloadAction.php');
		$filmDownloadAction = new filmDownloadAction();
		$download_info = $filmDownloadAction->getFilmDownloadByFilmId($film_info['id']);
		
		//输出模板
		include($gDOCUMENT_ROOT_SYSTEM.'templates/'.$gTEMPLATE.'/html/detail.tpl');
	}
}


?>
